<template>
  <div>
    <h1>财经新闻</h1>
      <el-col
        :span="20"
        v-for="(a,index) in showNews"
        :key="a.id"
        :offset="index =0"
      >
        <el-card :body-style="{ padding: '0px' }">
          <div class="left">
            <el-image
              style="width: 150px; height: 150px"
              :src="'http://120.77.71.211:9090/mynewsweb/'+a.path"
              class="image"
              fist="fill">
            </el-image>          
            </div>         
          <div style="padding: 14px">
            <div class="con">
              <a :href="'#/showNews?id='+a.id"><h1>{{a.title}}</h1></a>
              <a>{{a.summary}}</a><br><br>
              <div class="bottom clearfix">
                <span class="left">{{a.writer}}</span>
                <span class="right">{{a.time}}</span>
              </div>
            </div>
          </div>
        </el-card>
      </el-col>
  </div>
</template>
    
<script>
export default {
  name: "Economic", //经济

  data() {
    return {
      currentDate: new Date(),
      showNews:[],
    };
    
  },

  // 生命周期
  created(){
      //获取财经新闻
      var type="财经";
      var _this=this;
      this.$axios.get("http://120.77.71.211:9090/mynewsweb/api/findType?type="+type).then((res) => {
        _this.showNews=res.data;
      });
  }
};
</script>

<style>
  .bottom {
    margin-top: 13px;
    line-height: 12px;
  }

  .button {
    float: right;
  }

  .image {
    width: 100%;
    display: block;
  }

  .clearfix:before,
  .clearfix:after {
      display: table;
      content: "";
  }
  
  .clearfix:after {
      clear: both
  }

  .left{
    float: left;
    width:150px; 
    height:100%
  }

  .right{
    float: right;
  }

  .con{
    padding-left: 160px;
    position:relative;
  }
   a:link{
	color:rgb(67, 72, 145);
}
a:visited{
	color: rgb(67, 72, 145);
}
a{ text-decoration:none} 
</style>